package com.happy.mapper;

import com.happy.annotation.AutoFill;
import com.happy.enumeration.OperationType;
import com.happy.model.dos.CardListDO;
import com.happy.model.dto.CardAddDTO;
import com.happy.model.dto.CardPageQuery;
import com.happy.model.dto.CardUpdateDTO;
import com.happy.model.entity.Card;
import com.happy.model.entity.CardTime;
import com.happy.model.vo.CardListByIdVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

@Mapper
public interface CardMapper {
    List<CardListDO> pageList(CardPageQuery query);

    @AutoFill(OperationType.INSERT)
    void insertCard(CardAddDTO cardAddDTO);

    void insertCardTime(CardTime useTimes);

    Card selectById(Integer id);

    @Delete("delete from tb_card where id = #{id}")
    void deleteCard(Integer id);

    CardListByIdVO getCardListById(Integer id);

    @AutoFill(OperationType.UPDATE)
    void updateCard(CardUpdateDTO cardUpdateDTO);
}
